<?php
    class admin_manufacturer_controller extends controllerBase
    {
        public function process()
        {
            database::isAdmin(true);
            $oDatabase = new database();
            $sQuery ='  PREFIX foaf: <http://xmlns.com/foaf/0.1/>
            PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
            PREFIX dc: <http://purl.org/dc/elements/1.1/>
            PREFIX bus: <'.URL::getLink('id/bussiness#').'>

            SELECT * 
            WHERE
            {
                ?uri rdf:type bus:manufacturer.
                ?uri bus:name ?name. 
                ?uri bus:description ?description.
                OPTIONAL
                {
                    ?uri bus:hasCategory ?categoryUri.
                    ?categoryUri bus:name ?categoryName.
                }
            }';
            $aManufacturers = $oDatabase->loadQuery($sQuery);  
            $this->aParams['aManufacturers']=$aManufacturers['result']['rows']; 
                       
            // Get all categories in database
            $sQuery ='  PREFIX foaf: <http://xmlns.com/foaf/0.1/>
            PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
            PREFIX dc: <http://purl.org/dc/elements/1.1/>
            PREFIX bus: <'.URL::getLink('id/bussiness#').'>

            SELECT * 
            WHERE
            {
                ?uri rdf:type bus:category.
                ?uri bus:name ?name. 
            }';
            $aCategories = $oDatabase->loadQuery($sQuery);  
            $this->aParams['aCategories']=$aCategories['result']['rows']; 
        }
    }
?>